package com.note7_9;

public class Thread1 extends Thread{

	private Rename rn1;
	private Rename rn2;
	
	public Thread1(Rename rn1,Rename rn2){
		super();
		this.rn1 = rn1;
		this.rn2 = rn2;
	}
	
	public void run(){
		System.out.println("----线程1开始-----");
		synchronized (rn1) {
			System.out.println("线程1修改name中...");
			rn1.setName("线程一");
			System.out.println("线程1修改name完成...等待线程2 资源中...");
			rn2.setName("线程二");
			System.out.println("线程2修改完成");
		}
		System.out.println("----线程1退出----");
	}
}
